﻿using MongoData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebTest
{
    /// <summary>
    /// w 的摘要说明
    /// </summary>
    public class w : IHttpHandler
    {
        List<string> addrList = new List<string>()
        {
            "拱墅区",
            "滨江区",
            "上城区",
            "下城区",
            "萧山区"
        };
        public void ProcessRequest(HttpContext context)
        {
            var factory = new MongoData.MogonDbFactory();
            Random rd = new Random();
            var userCollection = factory.Database.GetCollection<User>("User");
            var aaa = userCollection.FindAll().ToList();
            for (int i = 0; i < 1000; i++)
            {
                userCollection.Insert(new User()
                {
                    _id = "u_" + i,
                    Address= addrList[rd.Next(0,4)],
                    Age=rd.Next(20,30),
                    Name= "name_" + i,
                    UserType= rd.Next(1, 3)
                });
            }
            factory.Close();
            context.Response.Write("删除了啊");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}